package client;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.naming.ConfigurationException;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import server.CompanyInterface;
import server.EnterpriceInterface;
import server.InvestComInterface;
import server.SaleComInterface;

public class InvestComInfo_GUI extends JDialog {

	private final JPanel contentPanel = new JPanel();

	/**
	 * Launch the application.
	 *//*
	public static void main(String[] args) {
		try {
			InvestComInfo_GUI dialog = new InvestComInfo_GUI();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public InvestComInfo_GUI() throws ConfigurationException , RemoteException ,MalformedURLException,NotBoundException{
		setTitle("\u672C\u516C\u53F8\u57FA\u672C\u4FE1\u606F");
		setModalityType(ModalityType.APPLICATION_MODAL);
		setBounds(100, 100, 450, 300);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		{
			JLabel label = new JLabel("\u540D\u79F0\uFF1A");
			label.setBounds(68, 10, 54, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u94F6\u884C\u8D26\u6237\uFF1A");
			label.setBounds(68, 35, 71, 15);
			contentPanel.add(label);
		}
		{
			JLabel lblNewLabel = new JLabel("\u804C\u5DE5\u4EBA\u6570\uFF1A");
			lblNewLabel.setBounds(68, 135, 71, 15);
			contentPanel.add(lblNewLabel);
		}
		{
			JLabel label = new JLabel("\u6700\u5927\u804C\u5DE5\u4EBA\u6570\uFF1A");
			label.setBounds(68, 160, 90, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u8D26\u6237\u8D44\u91D1\uFF1A");
			label.setBounds(68, 60, 71, 15);
			contentPanel.add(label);
		}
		{
			JLabel lblNewLabel_1 = new JLabel("\u8D37\u6B3E\u91D1\u989D\uFF1A");
			lblNewLabel_1.setBounds(68, 85, 71, 15);
			contentPanel.add(lblNewLabel_1);
		}
		{
			JLabel lblNewLabel_2 = new JLabel("\u53EF\u8D37\u6B3E\u4E0A\u9650\uFF1A");
			lblNewLabel_2.setBounds(68, 110, 90, 15);
			contentPanel.add(lblNewLabel_2);
		}
		{
			JLabel label = new JLabel("\u6700\u5927\u53EF\u6295\u8D44\u91D1\u989D\uFF1A");
			label.setBounds(68, 184, 108, 15);
			contentPanel.add(label);
		}
		
		
		try
		{
			Configuration config=new Configuration();
			String rmiAddress=config.getRmiAddress();
			
			InvestComInterface ICI=(InvestComInterface)  Naming.lookup(rmiAddress+"InvestCom"); 
			CompanyInterface CI=(CompanyInterface) Naming.lookup(rmiAddress+"Company"); 
			EnterpriceInterface EI=(EnterpriceInterface) Naming.lookup(rmiAddress+"Enterprice"); 
		
		{
			JLabel label = new JLabel(EI.getName(EnterInvestCom_GUI.ComID));
			label.setBounds(190, 10, 54, 15);
			contentPanel.add(label);
		}
		{
			String bai =String.valueOf(EI.getBankAccountID(EnterInvestCom_GUI.ComID));
			JLabel label = new JLabel(bai);
			label.setBounds(190, 35, 54, 15);
			contentPanel.add(label);
		}
		
		{
			String f =String.valueOf(CI.getFounds(EnterInvestCom_GUI.ComID));
			JLabel label = new JLabel(f);
			label.setBounds(190, 60, 54, 15);
			contentPanel.add(label);
		}
		{
			String lv=String.valueOf(CI.getLoanVal(EnterInvestCom_GUI.ComID));
			JLabel label = new JLabel("lv");
			label.setBounds(190, 85, 54, 15);
			contentPanel.add(label);
		}
		{
			String mlv=String.valueOf(CI.getMaxLoanVal(EnterInvestCom_GUI.ComID));
			JLabel label = new JLabel(mlv);
			label.setBounds(190, 110, 54, 15);
			contentPanel.add(label);
		}
		{
			String sn=String.valueOf(CI.getStaffNum(EnterInvestCom_GUI.ComID));
			JLabel label = new JLabel(sn);
			label.setBounds(190, 135, 54, 15);
			contentPanel.add(label);
		}
		{
			String ms=String.valueOf(CI.getMaxStaff(EnterInvestCom_GUI.ComID));
			JLabel label = new JLabel(ms);
			label.setBounds(190, 160, 54, 15);
			contentPanel.add(label);
		}
		{
			String miv=String.valueOf(ICI.getMaxInvestFounds(EnterInvestCom_GUI.ComID));
			JLabel label = new JLabel(miv);
			label.setBounds(190, 184, 54, 15);
			contentPanel.add(label);
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton cancelButton = new JButton("Cancel");
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						dispose();
						InvestComWorker_3_GUI dialog;
						dialog = new InvestComWorker_3_GUI();
						dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
						dialog.setVisible(true);
					
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}
